//
//  RMMRegionView.m
//  Romomo
//
//  Created by puman on 16/10/8.
//  Copyright © 2016年 mazegong. All rights reserved.
//

#import "RMMRegionView.h"

@implementation RMMRegionView
{
    UILabel *_label;
    UIImageView *_imageV;
}

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        UIView *allRegionView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.width, 24)];
        [self addSubview:allRegionView];
        
        UILabel *allRegionLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, allRegionView.width - kMaric - kRow, allRegionView.height)];
        allRegionLabel.font = kFont(13);
        allRegionLabel.textColor = COLORFROMCODE(0x9B9B9B, 1);
        allRegionLabel.text = @"当前定位地址";
        [allRegionView addSubview:allRegionLabel];

        _label = [[UILabel alloc] initWithFrame:CGRectMake(15 , allRegionView.bottom, kScreenWideth - 49, 49)];
        _label.textColor = COLORFROMCODE(0x4A4A4A, 1);
        _label.font = kFont(16);
        _label.text = @"定位中";
        [self addSubview:_label];
        
        _imageV = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenWideth - 34,allRegionView.bottom +  49 / 2 - 12, 24, 24)];
        _imageV.image = [UIImage imageNamed:@"定位@3x"];
        _imageV.hidden = YES;
        [self addSubview:_imageV];
        
        UILabel *lineLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, self.height - 20.5, self.width - 15, 0.5)];
        lineLabel.backgroundColor = RGBA(221, 221, 221, 1);
        [self addSubview:lineLabel];

        UILabel *regionLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, lineLabel.bottom, self.width - 15, 20)];
        regionLabel.font = kFont(13);
        regionLabel.textColor = COLORFROMCODE(0x9B9B9B, 1);
        regionLabel.text = @"全部服务地址";
        [self addSubview:regionLabel];

    }
    return self;
}
- (void)setCityName:(NSString *)cityName{
    if (cityName) {
        _label.text = cityName;
        _label.textColor = COLORFROMCODE(0x53C7C6, 1);
        _imageV.hidden = NO;
    } else {
        _label.text = @"定位中";
        _label.textColor = COLORFROMCODE(0x4A4A4A, 1);
        _imageV.hidden = YES;
    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
